package com.atguigu.bigdata.spark.core.rdd.io

import org.apache.spark.{SparkConf, SparkContext}

/**
  * create by undeRdoG on  2021-06-14  17:36
  * 凡心所向，素履以往，生如逆旅，一苇以航。
  */
object Spark01_RDD_Save {
  def main(args: Array[String]): Unit = {
    val sparkConf = new SparkConf().setAppName("Partition").setMaster("local[*]")

    val sc = new SparkContext(sparkConf)

    val rdd = sc.makeRDD(
      List(
        ("a",1),
        ("b",2),
        ("c",3)
      )
    )

    rdd.saveAsTextFile("io/output1")
    rdd.saveAsObjectFile("io/output2")

    /**
    * saveAsSequenceFile  RDD  必须是键值类型
    * */
    rdd.saveAsSequenceFile("io/output3")
  }
}
